@a=global float 2.000000e+00,align 4
@b=global [10 x float] zeroinitializer, align 4
;declare Global variables

define float @mul(float %temp){
        %a_value = load float, float*@a,align 4
        %result=fmul float %temp,%a_value
        ret float %result
}


define i32 @main(){
	%arrayptr = getelementptr inbounds [10 x float], [10 x float]* @b, i32 0, i32 0
	%length=call i32 @getfarray(float*%arrayptr)
	%cmp_re=icmp sle i32 %length, 9
	br i1 %cmp_re,label %t,label %f
t:
        %index = alloca i32       
        store i32 0, i32* %index
        br label %loopStart
loopStart:
	%idx = load i32, i32* %index
        %arrayptr2 = getelementptr inbounds [10 x float], [10 x float]* @b, i32 0, i32 %idx
        %endCond = icmp eq i32 %idx, %length
	br i1 %endCond, label %loopEnd, label %loopBody
loopBody:
	%element = load float, float* %arrayptr2
	%product = call float @mul(float %element)
	store float %product, float* %arrayptr2
	%newIndex = add i32 %idx, 1
	store i32 %newIndex, i32* %index
	br label %loopStart
loopEnd:
        call void @putfarray(i32 %length,float*%arrayptr)
        ret i32 0
f:
	ret i32 0
}

declare i32 @getfarray(float*)
declare void @putfarray(i32,float*)
